<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <title>需求列表 - 高级筛选</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome 图标 -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css">
    
    <style>
        :root {
            --primary: #4f46e5;
            --primary-light: #818cf8;
            --primary-dark: #3730a3;
            --secondary: #ec4899;
            --success: #10b981;
            --warning: #f59e0b;
            --danger: #ef4444;
            --text-primary: #1e293b;
            --text-secondary: #64748b;
            --text-tertiary: #94a3b8;
            --bg-light: #f8fafc;
            --bg-white: #ffffff;
            --bg-gray: #f1f5f9;
            --bg-gray-dark: #e2e8f0;
            --border-light: #e2e8f0;
            --border-medium: #cbd5e1;
            --radius: 12px;
            --radius-sm: 8px;
            --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
        }
        
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
            background-color: var(--bg-light);
            color: var(--text-primary);
            padding-top: 56px;
            padding-bottom: 60px;
        }
        
        /* 顶部导航 */
        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 56px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 0 16px;
            z-index: 1000;
            border-bottom: 1px solid var(--border-light);
        }
        
        .nav-title {
            font-size: 1.1rem;
            font-weight: 600;
            text-align: center;
            flex: 1;
        }
        
        .nav-action {
            color: var(--text-secondary);
            background: none;
            border: none;
            font-size: 1.2rem;
            width: 40px;
            height: 40px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .nav-action:hover {
            background-color: var(--bg-light);
        }
        
        .nav-action.primary {
            color: var(--primary);
        }
        
        /* 搜索栏 */
        .search-container {
            padding: 12px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
        }
        
        .search-box {
            position: relative;
            background-color: var(--bg-gray);
            border-radius: 24px;
            padding: 8px 16px;
            display: flex;
            align-items: center;
        }
        
        .search-icon {
            color: var(--text-tertiary);
            font-size: 0.95rem;
            margin-right: 8px;
        }
        
        .search-input {
            flex: 1;
            background: none;
            border: none;
            outline: none;
            font-size: 0.9rem;
            color: var(--text-primary);
        }
        
        .search-input::placeholder {
            color: var(--text-tertiary);
        }
        
        /* 快捷筛选栏 - 水平滚动式 */
        .quick-filters {
            display: flex;
            padding: 8px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            overflow-x: auto;
            scrollbar-width: none;
            gap: 8px;
        }
        
        .quick-filters::-webkit-scrollbar {
            display: none;
        }
        
        .filter-chip {
            white-space: nowrap;
            padding: 6px 12px;
            border-radius: 16px;
            font-size: 0.85rem;
            background-color: var(--bg-gray);
            color: var(--text-secondary);
            border: none;
            display: flex;
            align-items: center;
            gap: 6px;
        }
        
        .filter-chip.active {
            background-color: var(--primary);
            color: white;
        }
        
        .filter-chip .icon {
            font-size: 0.9rem;
        }
        
        /* 高级筛选区域 */
        .advanced-filters {
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            margin-bottom: 12px;
        }
        
        .filter-section {
            padding: 12px 16px;
            border-bottom: 1px solid var(--border-light);
        }
        
        .filter-section:last-child {
            border-bottom: none;
        }
        
        .filter-title {
            font-weight: 600;
            font-size: 0.95rem;
            margin-bottom: 12px;
            color: var(--text-primary);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .filter-toggle {
            color: var(--primary);
            font-size: 0.85rem;
            background: none;
            border: none;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        /* 分类筛选 - 图标网格式 */
        .category-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 12px;
        }
        
        .category-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            padding: 10px 0;
            border-radius: var(--radius-sm);
            background-color: var(--bg-gray);
            color: var(--text-secondary);
            text-decoration: none;
        }
        
        .category-item.active {
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
        }
        
        .category-item-icon {
            font-size: 1.2rem;
            margin-bottom: 6px;
        }
        
        .category-item-name {
            font-size: 0.75rem;
            text-align: center;
        }
        
        /* 价格筛选 - 滑块式 */
        .price-filter {
            padding: 10px 0;
        }
        
        .price-range {
            width: 100%;
            margin: 16px 0;
        }
        
        .price-labels {
            display: flex;
            justify-content: space-between;
            font-size: 0.85rem;
            color: var(--text-secondary);
        }
        
        .price-display {
            background-color: var(--bg-gray);
            border-radius: 8px;
            padding: 8px 12px;
            text-align: center;
            margin-top: 8px;
            font-weight: 500;
        }
        
        /* 时间筛选 - 选项按钮式 */
        .time-options {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
        }
        
        .time-option {
            padding: 6px 12px;
            border-radius: 16px;
            font-size: 0.85rem;
            background-color: var(--bg-gray);
            color: var(--text-secondary);
            border: none;
        }
        
        .time-option.active {
            background-color: var(--primary);
            color: white;
        }
        
        /* 距离筛选 - 下拉选择式 */
        .distance-select {
            width: 100%;
            padding: 10px 12px;
            border-radius: 8px;
            background-color: var(--bg-gray);
            border: 1px solid var(--border-light);
            color: var(--text-primary);
            font-size: 0.9rem;
            appearance: none;
            background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11l4-4H4l4 4z'/%3E%3C/svg%3E");
            background-repeat: no-repeat;
            background-position: right 12px center;
        }
        
        /* 筛选标签栏 - 已选条件展示 */
        .selected-filters {
            padding: 8px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            align-items: center;
        }
        
        .selected-filters-title {
            font-size: 0.85rem;
            color: var(--text-tertiary);
            white-space: nowrap;
        }
        
        .selected-filter-tag {
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 0.8rem;
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .remove-filter {
            background: none;
            border: none;
            color: var(--primary);
            font-size: 0.9rem;
            cursor: pointer;
        }
        
        .clear-all {
            font-size: 0.8rem;
            color: var(--text-secondary);
            background: none;
            border: none;
            margin-left: auto;
        }
        
        /* 筛选操作按钮 */
        .filter-actions {
            display: flex;
            padding: 12px 16px;
            background-color: var(--bg-white);
            border-bottom: 1px solid var(--border-light);
            gap: 12px;
        }
        
        .filter-btn {
            flex: 1;
            padding: 10px;
            border-radius: 8px;
            font-size: 0.9rem;
            font-weight: 500;
            border: none;
        }
        
        .reset-btn {
            background-color: var(--bg-gray);
            color: var(--text-secondary);
        }
        
        .apply-btn {
            background-color: var(--primary);
            color: white;
        }
        
        /* 需求列表容器 */
        .demands-container {
            padding: 12px 16px;
        }
        
        /* 需求卡片基础样式 */
        .demand-card {
            background-color: var(--bg-white);
            border-radius: var(--radius);
            overflow: hidden;
            margin-bottom: 16px;
            box-shadow: var(--shadow);
            text-decoration: none;
            color: var(--text-primary);
        }
        
        .demand-header {
            padding: 12px 16px;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .requester-avatar {
            width: 44px;
            height: 44px;
            border-radius: 50%;
            background-color: var(--bg-gray);
            flex-shrink: 0;
            overflow: hidden;
        }
        
        .requester-avatar img {
            width: 100%;
            height: 100%;
            object-fit: cover;
        }
        
        .requester-info {
            flex: 1;
        }
        
        .requester-name {
            font-weight: 600;
            font-size: 0.95rem;
            margin-bottom: 2px;
        }
        
        .demand-time {
            font-size: 0.75rem;
            color: var(--text-tertiary);
        }
        
        .verify-badge {
            color: var(--primary);
            font-size: 0.75rem;
            margin-left: 4px;
        }
        
        .demand-content {
            padding: 0 16px 12px;
        }
        
        .demand-title {
            font-weight: 600;
            font-size: 1rem;
            margin-bottom: 6px;
        }
        
        .demand-description {
            font-size: 0.9rem;
            color: var(--text-secondary);
            line-height: 1.5;
            margin-bottom: 8px;
        }
        
        .budget-tag {
            display: inline-block;
            padding: 3px 10px;
            background-color: rgba(79, 70, 229, 0.1);
            color: var(--primary);
            border-radius: 4px;
            font-size: 0.8rem;
            font-weight: 500;
            margin-bottom: 10px;
        }
        
        .tags-container {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            margin-bottom: 10px;
        }
        
        .tag {
            background-color: var(--bg-gray);
            color: var(--text-secondary);
            padding: 3px 10px;
            border-radius: 12px;
            font-size: 0.75rem;
        }
        
        .demand-stats {
            display: flex;
            justify-content: space-between;
            padding: 8px 16px;
            border-top: 1px solid var(--border-light);
            font-size: 0.8rem;
            color: var(--text-tertiary);
        }
        
        .demand-stat-item {
            display: flex;
            align-items: center;
            gap: 4px;
        }
        
        .stat-value {
            font-weight: 600;
            color: var(--text-primary);
        }
        
        /* 图片样式变体 */
        .demand-multi-image .demand-images {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 4px;
            margin-bottom: 12px;
        }
        
        .demand-multi-image .demand-image {
            aspect-ratio: 1;
            position: relative;
        }
        
        .demand-multi-image .demand-image img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            border-radius: var(--radius-sm);
        }
        
        .demand-no-image .demand-content {
            padding-bottom: 16px;
        }
        
        /* 加载更多 */
        .load-more {
            padding: 16px 0;
            text-align: center;
        }
        
        .load-more-btn {
            background-color: var(--bg-white);
            border: 1px solid var(--border-light);
            color: var(--text-secondary);
            padding: 8px 24px;
            border-radius: 20px;
            font-size: 0.9rem;
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0 auto;
        }
        
        /* 底部导航 */
        .bottom-nav {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: 60px;
            background-color: var(--bg-white);
            display: flex;
            justify-content: space-around;
            align-items: center;
            border-top: 1px solid var(--border-light);
            z-index: 1000;
        }
        
        .nav-item {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            color: var(--text-secondary);
            font-size: 0.7rem;
            gap: 4px;
            flex: 1;
            height: 100%;
            text-decoration: none;
        }
        
        .nav-item.active {
            color: var(--primary);
        }
        
        .nav-icon {
            font-size: 1.2rem;
        }
        
        /* 提示消息 */
        .toast {
            position: fixed;
            bottom: 80px;
            left: 50%;
            transform: translateX(-50%);
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 16px;
            border-radius: 4px;
            z-index: 9999;
            font-size: 0.85rem;
            opacity: 0;
            transition: opacity 0.3s ease;
        }
        
        .toast.show {
            opacity: 1;
        }
        
        /* 筛选面板切换动画 */
        .filter-panel {
            max-height: 0;
            overflow: hidden;
            transition: max-height 0.3s ease;
        }
        
        .filter-panel.expanded {
            max-height: 500px;
        }
    </style>
</head>
<body>
    <!-- 顶部导航 -->
    <div class="top-nav">
        <button class="nav-action" id="backBtn">
            <i class="fas fa-arrow-left"></i>
        </button>
        <div class="nav-title">需求列表</div>
        <button class="nav-action primary" id="addDemandBtn">
            <i class="fas fa-plus"></i>
        </button>
    </div>
    
    <!-- 搜索栏 -->
    <div class="search-container">
        <div class="search-box">
            <i class="fas fa-search search-icon"></i>
            <input type="text" class="search-input" placeholder="搜索需求、服务或请求者...">
        </div>
    </div>
    
    <!-- 快捷筛选栏 - 水平滚动式 -->
    <div class="quick-filters">
        <button class="filter-chip active">
            <span>全部</span>
        </button>
        <button class="filter-chip">
            <i class="fas fa-clock icon"></i>
            <span>最新发布</span>
        </button>
        <button class="filter-chip">
            <i class="fas fa-fire icon"></i>
            <span>热门需求</span>
        </button>
        <button class="filter-chip">
            <i class="fas fa-money-bill icon"></i>
            <span>预算从高到低</span>
        </button>
        <button class="filter-chip">
            <i class="fas fa-map-marker-alt icon"></i>
            <span>附近优先</span>
        </button>
        <button class="filter-chip" id="advancedFilterToggle">
            <i class="fas fa-sliders icon"></i>
            <span>高级筛选</span>
        </button>
    </div>
    
    <!-- 已选筛选条件 -->
    <div class="selected-filters">
        <span class="selected-filters-title">已选:</span>
        <div class="selected-filter-tag">
            <span>数码</span>
            <button class="remove-filter"><i class="fas fa-times"></i></button>
        </div>
        <div class="selected-filter-tag">
            <span>¥100-500</span>
            <button class="remove-filter"><i class="fas fa-times"></i></button>
        </div>
        <div class="selected-filter-tag">
            <span>3天内</span>
            <button class="remove-filter"><i class="fas fa-times"></i></button>
        </div>
        <button class="clear-all">清除全部</button>
    </div>
    
    <!-- 高级筛选区域 -->
    <div class="advanced-filters" id="advancedFilters">
        <!-- 分类筛选 - 图标网格式 -->
        <div class="filter-section">
            <div class="filter-title">
                <span>需求分类</span>
                <button class="filter-toggle" data-target="categoryPanel">
                    <span>收起</span>
                    <i class="fas fa-chevron-up"></i>
                </button>
            </div>
            <div class="filter-panel expanded" id="categoryPanel">
                <div class="category-grid">
                    <button class="category-item active">
                        <div class="category-item-icon">
                            <i class="fas fa-th"></i>
                        </div>
                        <div class="category-item-name">全部</div>
                    </button>
                    <button class="category-item">
                        <div class="category-item-icon">
                            <i class="fas fa-laptop"></i>
                        </div>
                        <div class="category-item-name">数码</div>
                    </button>
                    <button class="category-item">
                        <div class="category-item-icon">
                            <i class="fas fa-home"></i>
                        </div>
                        <div class="category-item-name">家居</div>
                    </button>
                    <button class="category-item">
                        <div class="category-item-icon">
                            <i class="fas fa-car"></i>
                        </div>
                        <div class="category-item-name">出行</div>
                    </button>
                    <button class="category-item">
                        <div class="category-item-icon">
                            <i class="fas fa-tools"></i>
                        </div>
                        <div class="category-item-name">维修</div>
                    </button>
                    <button class="category-item">
                        <div class="category-item-icon">
                            <i class="fas fa-hands-helping"></i>
                        </div>
                        <div class="category-item-name">服务</div>
                    </button>
                    <button class="category-item">
                        <div class="category-item-icon">
                            <i class="fas fa-graduation-cap"></i>
                        </div>
                        <div class="category-item-name">教育</div>
                    </button>
                    <button class="category-item">
                        <div class="category-item-icon">
                            <i class="fas fa-plus-circle"></i>
                        </div>
                        <div class="category-item-name">更多</div>
                    </button>
                </div>
            </div>
        </div>
        
        <!-- 价格筛选 - 滑块式 -->
        <div class="filter-section">
            <div class="filter-title">
                <span>预算范围</span>
                <button class="filter-toggle" data-target="pricePanel">
                    <span>收起</span>
                    <i class="fas fa-chevron-up"></i>
                </button>
            </div>
            <div class="filter-panel expanded" id="pricePanel">
                <div class="price-filter">
                    <input type="range" min="0" max="10000" value="5000" class="price-range" id="priceRange">
                    <div class="price-labels">
                        <span>¥0</span>
                        <span>¥5000</span>
                        <span>¥10000+</span>
                    </div>
                    <div class="price-display">
                        预算范围: ¥0 - ¥5000
                    </div>
                </div>
            </div>
        </div>
        
        <!-- 时间筛选 - 选项按钮式 -->
        <div class="filter-section">
            <div class="filter-title">
                <span>发布时间</span>
                <button class="filter-toggle" data-target="timePanel">
                    <span>收起</span>
                    <i class="fas fa-chevron-up"></i>
                </button>
            </div>
            <div class="filter-panel expanded" id="timePanel">
                <div class="time-options">
                    <button class="time-option">不限</button>
                    <button class="time-option active">24小时内</button>
                    <button class="time-option">3天内</button>
                    <button class="time-option">1周内</button>
                    <button class="time-option">1个月内</button>
                </div>
            </div>
        </div>
        
        <!-- 距离筛选 - 下拉选择式 -->
        <div class="filter-section">
            <div class="filter-title">
                <span>距离范围</span>
                <button class="filter-toggle" data-target="distancePanel">
                    <span>收起</span>
                    <i class="fas fa-chevron-up"></i>
                </button>
            </div>
            <div class="filter-panel expanded" id="distancePanel">
                <select class="distance-select">
                    <option value="0">不限距离</option>
                    <option value="1">1公里内</option>
                    <option value="3" selected>3公里内</option>
                    <option value="5">5公里内</option>
                    <option value="10">10公里内</option>
                    <option value="20">20公里内</option>
                </select>
            </div>
        </div>
        
        <!-- 筛选操作按钮 -->
        <div class="filter-actions">
            <button class="filter-btn reset-btn" id="resetFilters">重置筛选</button>
            <button class="filter-btn apply-btn" id="applyFilters">应用筛选</button>
        </div>
    </div>
    
    <!-- 需求列表容器 -->
    <div class="demands-container">
        <!-- 需求卡片 - 多图片样式 -->
        <div class="demand-card demand-multi-image">
            <div class="demand-header">
                <div class="requester-avatar">
                    <img src="https://picsum.photos/id/64/100/100" alt="用户头像">
                </div>
                <div class="requester-info">
                    <div class="requester-name">
                        张小明 <i class="fas fa-check-circle verify-badge"></i>
                    </div>
                    <div class="demand-time">2小时前</div>
                </div>
            </div>
            <div class="demand-content">
                <div class="demand-title">求购二手摄影器材一套</div>
                <div class="demand-description">
                    寻找一套入门级摄影器材，包含相机机身和镜头，最好是佳能或尼康品牌，成色较新，功能完好。
                </div>
                <div class="budget-tag">预算 ¥3000-5000</div>
                <div class="tags-container">
                    <span class="tag">摄影器材</span>
                    <span class="tag">求购</span>
                    <span class="tag">可议价</span>
                </div>
                <div class="demand-images">
                    <div class="demand-image">
                        <img src="https://picsum.photos/id/237/300/300" alt="参考图1">
                    </div>
                    <div class="demand-image">
                        <img src="https://picsum.photos/id/96/300/300" alt="参考图2">
                    </div>
                    <div class="demand-image">
                        <img src="https://picsum.photos/id/201/300/300" alt="参考图3">
                    </div>
                </div>
            </div>
            <div class="demand-stats">
                <div class="demand-stat-item">
                    <i class="far fa-eye"></i>
                    <span class="stat-value">215</span>
                    <span>浏览</span>
                </div>
                <div class="demand-stat-item">
                    <i class="far fa-comment"></i>
                    <span class="stat-value">32</span>
                    <span>回应</span>
                </div>
                <div class="demand-stat-item">
                    <i class="fas fa-map-marker-alt"></i>
                    <span>2.5km</span>
                </div>
            </div>
        </div>
        
        <!-- 需求卡片 - 无图片样式 -->
        <div class="demand-card demand-no-image">
            <div class="demand-header">
                <div class="requester-avatar">
                    <img src="https://picsum.photos/id/65/100/100" alt="用户头像">
                </div>
                <div class="requester-info">
                    <div class="requester-name">
                        李华 <i class="fas fa-check-circle verify-badge"></i>
                    </div>
                    <div class="demand-time">昨天 10:15</div>
                </div>
            </div>
            <div class="demand-content">
                <div class="demand-title">寻求笔记本电脑维修服务</div>
                <div class="demand-description">
                    笔记本电脑无法开机，可能是电池或主板问题，希望找专业人士维修，最好能上门服务，品牌是联想。
                </div>
                <div class="budget-tag">预算 ¥100-500</div>
                <div class="tags-container">
                    <span class="tag">电脑维修</span>
                    <span class="tag">服务</span>
                    <span class="tag">上门服务</span>
                </div>
            </div>
            <div class="demand-stats">
                <div class="demand-stat-item">
                    <i class="far fa-eye"></i>
                    <span class="stat-value">186</span>
                    <span>浏览</span>
                </div>
                <div class="demand-stat-item">
                    <i class="far fa-comment"></i>
                    <span class="stat-value">17</span>
                    <span>回应</span>
                </div>
                <div class="demand-stat-item">
                    <i class="fas fa-map-marker-alt"></i>
                    <span>3.8km</span>
                </div>
            </div>
        </div>
    </div>
    
    <!-- 加载更多 -->
    <div class="load-more">
        <button class="load-more-btn" id="loadMoreBtn">
            <i class="fas fa-spinner fa-spin" style="display: none;"></i>
            <span>加载更多</span>
        </button>
    </div>
    
    <!-- 底部导航 -->
    <div class="bottom-nav">
        <a href="#" class="nav-item">
            <i class="fas fa-home nav-icon"></i>
            <span>首页</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-compass nav-icon"></i>
            <span>发现</span>
        </a>
        <a href="#" class="nav-item active">
            <i class="fas fa-list-alt nav-icon"></i>
            <span>需求</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-bell nav-icon"></i>
            <span>通知</span>
        </a>
        <a href="#" class="nav-item">
            <i class="fas fa-user nav-icon"></i>
            <span>我的</span>
        </a>
    </div>
    
    <!-- 提示消息元素 -->
    <div class="toast" id="toast"></div>
    
    <!-- Bootstrap JS Bundle with Popper -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        // DOM元素
        const backBtn = document.getElementById('backBtn');
        const addDemandBtn = document.getElementById('addDemandBtn');
        const filterChips = document.querySelectorAll('.filter-chip');
        const advancedFilterToggle = document.getElementById('advancedFilterToggle');
        const advancedFilters = document.getElementById('advancedFilters');
        const filterToggles = document.querySelectorAll('.filter-toggle');
        const categoryItems = document.querySelectorAll('.category-item');
        const timeOptions = document.querySelectorAll('.time-option');
        const priceRange = document.getElementById('priceRange');
        const priceDisplay = document.querySelector('.price-display');
        const resetFilters = document.getElementById('resetFilters');
        const applyFilters = document.getElementById('applyFilters');
        const removeFilterTags = document.querySelectorAll('.remove-filter');
        const clearAllFilters = document.querySelector('.clear-all');
        const loadMoreBtn = document.getElementById('loadMoreBtn');
        
        // 初始化状态
        let priceRangeValue = 5000;
        
        // 高级筛选面板切换
        let advancedFiltersVisible = true;
        advancedFilterToggle.addEventListener('click', function() {
            advancedFiltersVisible = !advancedFiltersVisible;
            if (advancedFiltersVisible) {
                advancedFilters.style.display = 'block';
                showToast('已显示高级筛选');
            } else {
                advancedFiltersFilters.style.display = 'none';
                showToast('已隐藏高级筛选');
            }
        });
        
        // 筛选面板展开/收起
        filterToggles.forEach(toggle => {
            toggle.addEventListener('click', function() {
                const targetId = this.getAttribute('data-target');
                const targetPanel = document.getElementById(targetId);
                const icon = this.querySelector('i');
                const text = this.querySelector('span');
                
                if (targetPanel.classList.contains('expanded')) {
                    targetPanel.classList.remove('expanded');
                    icon.classList.remove('fa-chevron-up');
                    icon.classList.add('fa-chevron-down');
                    text.textContent = '展开';
                } else {
                    targetPanel.classList.add('expanded');
                    icon.classList.remove('fa-chevron-down');
                    icon.classList.add('fa-chevron-up');
                    text.textContent = '收起';
                }
            });
        });
        
        // 快捷筛选切换
        filterChips.forEach(chip => {
            chip.addEventListener('click', function() {
                // 只有非"高级筛选"的按钮才切换active状态
                if (!this.id) {
                    filterChips.forEach(c => c.classList.remove('active'));
                    this.classList.add('active');
                    const filterText = this.querySelector('span').textContent;
                    showToast(`已切换到${filterText}`);
                }
            });
        });
        
        // 分类筛选
        categoryItems.forEach(item => {
            item.addEventListener('click', function() {
                categoryItems.forEach(i => i.classList.remove('active'));
                this.classList.add('active');
                const categoryName = this.querySelector('.category-item-name').textContent;
                showToast(`已选择${categoryName}分类`);
            });
        });
        
        // 时间筛选
        timeOptions.forEach(option => {
            option.addEventListener('click', function() {
                timeOptions.forEach(o => o.classList.remove('active'));
                this.classList.add('active');
                showToast(`已选择${this.textContent}发布的需求`);
            });
        });
        
        // 价格范围筛选
        priceRange.addEventListener('input', function() {
            priceRangeValue = this.value;
            priceDisplay.textContent = `预算范围: ¥0 - ¥${priceRangeValue}`;
        });
        
        // 应用筛选
        applyFilters.addEventListener('click', function() {
            showToast('筛选条件已应用');
            // 这里可以添加实际筛选逻辑
        });
        
        // 重置筛选
        resetFilters.addEventListener('click', function() {
            // 重置分类选择
            categoryItems.forEach(i => i.classList.remove('active'));
            categoryItems[0].classList.add('active');
            
            // 重置时间选择
            timeOptions.forEach(o => o.classList.remove('active'));
            timeOptions[0].classList.add('active');
            
            // 重置价格范围
            priceRangeValue = 5000;
            priceRange.value = priceRangeValue;
            priceDisplay.textContent = `预算范围: ¥0 - ¥${priceRangeValue}`;
            
            // 重置距离选择
            document.querySelector('.distance-select').value = 0;
            
            showToast('已重置所有筛选条件');
        });
        
        // 移除单个筛选条件
        removeFilterTags.forEach(tag => {
            tag.addEventListener('click', function() {
                const filterText = this.parentElement.querySelector('span').textContent;
                this.parentElement.remove();
                showToast(`已移除筛选: ${filterText}`);
                
                // 如果没有筛选条件了，隐藏标题
                if (document.querySelectorAll('.selected-filter-tag').length === 0) {
                    document.querySelector('.selected-filters-title').style.display = 'none';
                }
            });
        });
        
        // 清除所有筛选条件
        clearAllFilters.addEventListener('click', function() {
            const filterTags = document.querySelectorAll('.selected-filter-tag');
            if (filterTags.length > 0) {
                filterTags.forEach(tag => tag.remove());
                document.querySelector('.selected-filters-title').style.display = 'none';
                showToast('已清除所有筛选条件');
            }
        });
        
        // 加载更多
        loadMoreBtn.addEventListener('click', function() {
            const spinner = this.querySelector('.fa-spinner');
            const text = this.querySelector('span');
            const originalText = text.textContent;
            
            spinner.style.display = 'inline-block';
            text.textContent = '加载中...';
            this.disabled = true;
            
            setTimeout(() => {
                spinner.style.display = 'none';
                text.textContent = originalText;
                this.disabled = false;
                showToast('已加载更多需求信息');
            }, 1500);
        });
        
        // 其他按钮事件
        backBtn.addEventListener('click', function() {
            history.back();
        });
        
        addDemandBtn.addEventListener('click', function() {
            showToast('发布新需求页面已打开');
        });
        
        // 提示消息功能
        function showToast(message) {
            const toast = document.getElementById('toast');
            toast.textContent = message;
            toast.classList.add('show');
            
            setTimeout(() => {
                toast.classList.remove('show');
            }, 2000);
        }
    </script>
</body>
</html>

